<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    class Phone{
      brand;
      price;
      color;

      constructor(brand, price, color){
        this.brand = brand;
        this.price = price;
        this.color = color;
      }

      call(){
        console.log('可以打电话...');
      }
    }

    //类
    class SmartPhone extends Phone{
      screen;
      memory;

      //声明构造方法  子类可以没有构造方法, 但是如果声明构造方法, 就『必须』要调用 super 函数
      constructor(brand, price, color, screen, memory){
        super(brand, price, color);
        this.screen = screen;
        this.memory = memory;
      }

      playGame(){
        console.log('玩游戏~~');
      }

    }

    //实例化对象
    let onePlus = new SmartPhone('1+', 2299, '蓝色', '5.5inch', '12G');

    // console.log(onePlus);
    // onePlus.call();

    onePlus.playGame();

  </script>
</body>
</html>